Skip to main content

All Questions

3votes
0answers
86views

A prime iterator in JavaScript

This is an implementation of a Sieve of Eratosthenes as [Symbol.iterator] in JavaScript. Comments welcome, my JS is a bit rusty. Making a class of this is mainly the reason to have fun with the ...
thst's user avatar
  • 236
7votes
3answers
1kviews

Counting words from stored .md files

The following searches recursively for all the mark down files - i. ending with the extension .md - inside a folder. It then stores the text of the files in an ...
wyc's user avatar
  • 555
1vote
1answer
68views

Bidirectional numeric (floating point) sequence iterator

I wanted a neat iterator that will always give me neat sequence of step spaced numbers. This is what I came up with, but I am a bit skeptical that I covered all ...
Tomáš Zato's user avatar
3votes
2answers
145views

A basic trivia app

The app grabs 10 questions from an API, displays them one by one with 4 multiple choice answers. These answers are clickable buttons that alert to whether the answer is correct or not. Finally the ...
millies1919's user avatar
2votes
1answer
145views

Rendering JSON arrays of unequal length as a table

I have a website where my users can create "table-like" layout dynamically. So imagine that my users can upload a text document, and then append columns to the document, and the output will then be ...
oliverbj's user avatar
21votes
5answers
7kviews

Count all vowels in string

For a homework assignment, I was asked to complete this CodeStepByStep problem. It's coded correctly and gave me a right answer. I'm just wondering if there's an easier way to solve this problem ...
Ben A's user avatar
  • 10.7k
1vote
2answers
68views

Combining arbitrary number of lists inside json

I have some JSON where each key stores an array, and I need to combine all those arrays into a single array. My current solution doesn't seem the most friendly to review, but without ...
Tony's user avatar
  • 305
1vote
1answer
531views

Find all starting indices in a string which are anagrams of a word

The task: Given a word W and a string S, find all starting indices in S which are anagrams of W. For example, given that W is "ab", and S is "abxaba", return 0, 3, and 4. My solution: <...
thadeuszlay's user avatar
4votes
2answers
96views

Loading items for an eCommerce site

I am attempting to make an eCommerce site from scratch. Right now I have the following code that gets all the items from a Firebase Firestore database and then adds HTML into an items div element ...
Jordan Baron's user avatar
6votes
1answer
228views

Lazy lists with transformations, using generators & iterators

I built this very-basic lazy list (I'll add more methods as I need them). You provide it an array, a generator or any iterator. It creates a lazy list, which lets you run a pipeline of transformations ...
Joseph Silber's user avatar
7votes
1answer
73views

Apply arbitrary action during recursive generator function

I've got this recursive generator function. It will traverse an object looking for "leafs", any keys that don't point to sub-objects. Then it applies one of two actions on the leaf and yields it. Any ...
Letharion's user avatar
4votes
2answers
463views

Iterators in JavaScript and remembering position

This is an attempt to write a function link that creates a linked list from an array: ...
52d6c6af's user avatar
3votes
1answer
95views

Handling arguments in a Python-like range() function in JavaScript

I'm making a Python-like range() function (see Python docs) using JavaScript. This function can take from 1 to 3 arguments. There are 3 variables (...
Michał Perłakowski's user avatar
7votes
2answers
9kviews

Range iterator in ES6 similar to Python and Ruby for

Background and Purpose For those unaccustomed to Ruby, Ruby supports range literals i.e. 1..4 meaning 1, 2, 3, 4 and ...
sqykly's user avatar
10votes
2answers
264views

String sequence in ES6

Given an unique string that represents a sequence of characters, the class should implement three methods (getNextChar, getNextString and the genSequence generator). How it works We give a sequence ...
Afonso Matos's user avatar

close